<template>
	<view class="">
		<scroll-view scroll-y="true" class="scroll">
			<view>
				<!-- <view>其他</view> -->
				<view v-for="(i,index) in Imageforall" :key="Imageforall.id">
					<view class="border">
						<view>
							{{i.name}}
						</view>
						<view class="scoref" v-show="i.isscore1">{{i.score1}}</view>
						<view class="desco" v-show="i.isdesco">{{i.deductedscore}}</view>

						<view class="btn" v-for="(j,index) in i.Imageall" :key="i.Imageall.id">
							<image :src="j.Image"
								style="width: 100rpx; height: 100rpx; margin-left: 20rpx; margin-top: 20rpx;"
								@click="checkimg(i,index)"></image>
							<button @click="addpicture(i,index)" :disabled="j.ban" class="picbtn">{{j.fname}}</button>
							<button @click="deducted(i,index)" class="scorebtn"
								v-show="j.isscorename">{{j.scorename}}</button>
							<button @click="canceldeducted(i,index)" class="scorebtn"
								v-show="j.isdscorename">{{j.cscorename}}</button>
								<button @click="remarkable(i,index)" class="remark">备注</button>
								<view class="" v-for="(s,index) in i.remarkall" :key="i.remarkall.id">
									<zwy-popup :ishide="i.uppo" width="750rpx" height="860rpx" :opacity="opacity"
										:cancelable="cancelable">
										<view class="tjid">
											<scroll-view scroll-y="true" class="uppoo">
												<view>
													<view class="" v-for="(s,index) in i.remarkall" :key="i.remarkall.id">
														<view class="uppoborder" @click="addremark(i,index)">{{s.remark}}</view>
													</view>
												</view>
											</scroll-view>
											<view class="delete" @click="isdele(i,index)">
												+
											</view>
										</view>
									
									</zwy-popup>
								</view>
							
							<view class=""></view>
						</view>
					</view>
				</view>
			</view>
		</scroll-view>
		<view class="bottom-btn">
			<button @click="submit" class="bmbtn">完成</button>
		</view>
		<view v-show="showw">
			<br>
			<br>
			<br>
			<br>
			<br>
			<br>
			<br>
			<br>
			<br>
			<br>
			<br>
			<br>
			<br>
			<br>
			<br>
			<br>
			<br>
			<br>
			<br>
			<canvas :style="{width:canvasWidth,height:canvasHeight}" canvas-id="myCanvas" @click="checkimg"></canvas>
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				det:4,
				falseremark:0,
				trueremark:null,
				dst:6,
				address: '',
				cancelable: false,
				opacity: 0.2,
				uppo: false,
				firstfirst: true,
				index:0,
				isstart: true,
				iaid: '',
				soyn: 0,
				point:'',
				alist: [],
				count: 0,
				putremark: '',
				latitude: '',
				longitude: '',
				tempFilePath: '',
				fileData: null,
				Evaluator: '',
				thisremark: true,
				isremark: true,
				ifaid: '',
				Image: '',
				igid: '',
				n: 0,
				ggid: '',
				showw: true,
				photoData: [],
				photoArray: [],
				canvasWidth: '',
				canvasHeight: '',
				canvasnone: '',
				photoIndex: 0,
				photoData: '',
				Imageforall: [{
						id: '0',
						tid: 0,
						point:'第1条',
						firstfirst: true,
						first: true,
						remark: '',
						uppo:false,
						index:null,
						count:0,
						top:true,
						down:false,
						xpremark:null,
						n: 0.6,
						remarkall:[
							{
								id: 0,
								remark: '1.路面有乱扔垃圾'
							},
							{
								id: 1,
								remark: '1.堆放杂物占用道路超过三分之一'
							},
							{
								id: 2,
								remark: '1.晾晒农作物占用道路超过三分之一'
							}
						],
						isimage: true,
						Imageall: [{
								id: '0',
								remark: '',
								isrecover: true,
								hk: null,
								Image: '../../../static/th.jpg',
								fname: '拍照',
								sname: '重拍',
								ban: true,
								scorename: '扣分',
								cscorename: '取消',
								isscorename: true,
								isdscorename: false,
							},
							{
								id: '1',
								remark: '',
								isrecover: true,
								hk: null,
								Image: '../../../static/th.jpg',
								fname: '拍照',
								sname: '重拍',
								ban: true,
								scorename: '扣分',
								cscorename: '取消',
								isscorename: true,
								isdscorename: false,
							},
							{
								id: '2',
								remark: '',
								isrecover: true,
								hk: null,
								Image: '../../../static/th.jpg',
								fname: '拍照',
								sname: '重拍',
								ban: true,
								scorename: '扣分',
								cscorename: '取消',
								isscorename: true,
								isdscorename: false,
							},
							{
								id: '3',
								remark: '',
								isrecover: true,
								hk: null,
								Image: '../../../static/th.jpg',
								fname: '拍照',
								sname: '重拍',
								ban: true,
								scorename: '扣分',
								cscorename: '取消',
								isscorename: true,
								isdscorename: false,
							},
							{
								id: '4',
								remark: '',
								isrecover: true,
								hk: null,
								Image: '../../../static/th.jpg',
								fname: '拍照',
								sname: '重拍',
								ban: true,
								scorename: '扣分',
								cscorename: '取消',
								isscorename: true,
								isdscorename: false,
							},
							{
								id: '5',
								remark: '',
								isrecover: true,
								hk: null,
								Image: '../../../static/th.jpg',
								fname: '拍照',
								sname: '重拍',
								ban: true,
								scorename: '扣分',
								cscorename: '取消',
								isscorename: true,
								isdscorename: false,
							},
							{
								id: '6',
								remark: '',
								isrecover: true,
								hk: null,
								Image: '../../../static/th.jpg',
								fname: '拍照',
								sname: '重拍',
								ban: true,
								scorename: '扣分',
								cscorename: '取消',
								isscorename: true,
								isdscorename: false,
							}
						],
						name: '1.路面有乱扔垃圾的；堆放杂物占用道路超过三分之一的；晾晒农作物占用道路超过三分之一的（农忙季节除外）。',
						Image: '../../../static/th.jpg',
						fname: '点击进行拍照',
						sname: '点击重新拍照',
						scorename: '点击扣分',
						ban: true,
						score1: 0,
						score2: 0.1,
						score3: 0.09,
						deductedscore: '已扣分',
						isdesco: false
					},
					{
						id: '1',
						tid: 1,
						uppo:false,
						count:0,
						top:true,
						down:false,
						index:null,
						point:'第2条',
						xpremark:null,
						firstfirst: true,
						first: true,
						remark: '',
						n: 0.6,
						remarkall: [{
							id: 0,
							remark: '2.道路或屯内巷道有成堆焚烧秸秆、枯草、垃圾或其它废弃物（面积约 1 ㎡计 1 处）造成污染'
						}],
						isimage: true,
						Imageall: [{
								id: '0',
								remark: '',
								isrecover: true,
								hk: null,
								Image: '../../../static/th.jpg',
								fname: '拍照',
								sname: '重拍',
								ban: true,
								scorename: '扣分',
								cscorename: '取消',
								isscorename: true,
								isdscorename: false,
							},
							{
								id: '1',
								remark: '',
								isrecover: true,
								hk: null,
								Image: '../../../static/th.jpg',
								fname: '拍照',
								sname: '重拍',
								ban: true,
								scorename: '扣分',
								cscorename: '取消',
								isscorename: true,
								isdscorename: false,
							},
							{
								id: '2',
								remark: '',
								isrecover: true,
								hk: null,
								Image: '../../../static/th.jpg',
								fname: '拍照',
								sname: '重拍',
								ban: true,
								scorename: '扣分',
								cscorename: '取消',
								isscorename: true,
								isdscorename: false,
							},
							{
								id: '3',
								remark: '',
								isrecover: true,
								hk: null,
								Image: '../../../static/th.jpg',
								fname: '拍照',
								sname: '重拍',
								ban: true,
								scorename: '扣分',
								cscorename: '取消',
								isscorename: true,
								isdscorename: false,
							},
							{
								id: '4',
								remark: '',
								isrecover: true,
								hk: null,
								Image: '../../../static/th.jpg',
								fname: '拍照',
								sname: '重拍',
								ban: true,
								scorename: '扣分',
								cscorename: '取消',
								isscorename: true,
								isdscorename: false,
							},
							{
								id: '5',
								remark: '',
								isrecover: true,
								hk: null,
								Image: '../../../static/th.jpg',
								fname: '拍照',
								sname: '重拍',
								ban: true,
								scorename: '扣分',
								cscorename: '取消',
								isscorename: true,
								isdscorename: false,
							},
							{
								id: '6',
								remark: '',
								isrecover: true,
								hk: null,
								Image: '../../../static/th.jpg',
								fname: '拍照',
								sname: '重拍',
								ban: true,
								scorename: '扣分',
								cscorename: '取消',
								isscorename: true,
								isdscorename: false,
							}
						],
						name: '2.道路或屯内巷道有成堆焚烧秸秆、枯草、垃圾或其它废弃物（面积约 1 ㎡计 1 处）造成污染的。',
						Image: '../../../static/th.jpg',
						fname: '点击进行拍照',
						sname: '点击重新拍照',
						scorename: '点击扣分',
						ban: true,
						score1: 0,
						score2: 0.1,
						score3: 0.09,
						deductedscore: '已扣分',
						isdesco: false
					}
				]

			}
		},
		onLoad() {
				console.log('你是谁')
				uni.getStorage({
					key: 'imgc1',
					success: res => {
						console.log('保存的')
						console.log(res)
						this.Imageforall = res.data
					}
				})
				uni.getStorage({
					key: 'detc1',
					success: res => {
						console.log('保存的')
						console.log(res)
						this.det = res.data.det
						this.alist = res.data.alist
						this.soyn = res.data.soyn
						this.dst = res.data.dst
						this.index = res.data.index
					}
				})
			
			console.log(this.$store.state.townclear)
			console.log(this.det)
		},
		methods: {
			isdele(e) {
				e.uppo = false
			},
			addremark(e, b) {
				console.log(e)
				console.log(b)
				// console.log(c)
				// console.log(d)
				this.alist[this.trueremark].Imageall[this.alist[this.trueremark].Imageall.length - 1].remark = this.Imageforall[e.id].remarkall[b].remark
				e.uppo = false
				console.log(this.Imageforall[this.ifaid].Imageall[this.iaid].hk)
				console.log(this.Imageforall)
				console.log(this.alist)
				uni.setStorage({
					key: 'imgc1',
					data: this.Imageforall,
					success: (res) => {
						console.log('成功了')
						console.log(res)
						console.log(this.Imageforall)
					}
				})
				// this.Imageforall[e.id].remarkall[b].remark = 
			},
			remarkable(e) {
				e.uppo = true

				console.log(this.uppo)
				console.log(e)
			},
			getTime() {
				var date = new Date(),
					year = date.getFullYear(),
					month = date.getMonth() + 1,
					day = date.getDate(),
					hour = date.getHours() < 10 ? "0" + date.getHours() : date.getHours(),
					minute = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes(),
					second = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
				month >= 1 && month <= 9 ? (month = "0" + month) : "";
				day >= 0 && day <= 9 ? (day = "0" + day) : "";
				var timer = year + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second;
				return timer;
			},
			canceldeducted(e, b) {
				uni.showModal({
					title: '提示',
					content: '是否对该条取消扣分',
					success: res => {
						var that = this
						if (res.confirm) {
							console.log('用户点击确定');
							console.log('vuex啊啊啊啊', that.$store.state.value)
							that.Imageforall[e.id].Imageall[b].isdscorename = false
							that.Imageforall[e.id].Imageall[b].isscorename = true
							that.Imageforall[e.id].Imageall[b].ban = true
							that.Imageforall[e.id].Imageall[b].Image = '../../../static/th.jpg'
							if (that.$store.state.value == 'a') {
								that.Imageforall[e.id].score1 = that.Imageforall[e.id].score1 + 0.4
								that.$store.state.allcountrysidescore[e.tid] = that.Imageforall[e.id].score1
								that.Imageforall[e.id].count -= 1
								console.log(that.Imageforall[e.id].score1)
							} else if (that.$store.state.value == 'b') {
								if(that.Imageforall[e.id].score1 == -2) {
									that.Imageforall[e.id].score1 = -1.7
									that.$store.state.allcountrysidescore[e.tid] = that.Imageforall[e.id].score1
									console.log(that.Imageforall[e.id].score1)
									that.Imageforall[e.id].count -= 1
								} else {
									that.Imageforall[e.id].score1 = that.Imageforall[e.id].score1 + 0.34
									that.Imageforall[e.id].score1 = that.Imageforall[e.id].score1.toFixed(2)
									that.Imageforall[e.id].score1 = parseFloat(that.Imageforall[e.id].score1)
									that.$store.state.allcountrysidescore[e.tid] = that.Imageforall[e.id].score1
									that.Imageforall[e.id].count -= 1
									console.log(that.Imageforall[e.id].score1)
								}
							} else if (that.$store.state.value == 'c') {
								if(that.Imageforall[e.id].score1 == -2) {
									that.Imageforall[e.id].score1 = -1.74
									that.Imageforall[e.id].count -= 1
									that.$store.state.allcountrysidescore[e.tid] = that.Imageforall[e.id].score1
									console.log(that.Imageforall[e.id].score1)
								} else {
									that.Imageforall[e.id].score1 = that.Imageforall[e.id].score1 + 0.29
									that.Imageforall[e.id].score1 = that.Imageforall[e.id].score1.toFixed(2)
									that.Imageforall[e.id].score1 = parseFloat(that.Imageforall[e.id].score1)
									that.$store.state.allcountrysidescore[e.tid] = that.Imageforall[e.id].score1
									that.Imageforall[e.id].count -= 1
									console.log(that.Imageforall[e.id].score1)
								}

							}

							if (that.Imageforall[e.id].score1 == 0) {
								that.Imageforall[e.id].isdesco = false
								that.Imageforall[e.id].isscore1 = false
								that.$store.state.count -= 1
							}
						} else if (res.cancel) {
							console.log('用户点击取消');
						}
					}
				})
				console.log(e.id)
				console.log(b)
				console.log(this.Imageforall)
			},
			
			deducted(e, b) {
				var that = this
				console.log(e)
				console.log(b)
				
				if (that.$store.state.value == 'a') {
					if (that.Imageforall[e.id].count > 4) {
						uni.showModal({
							title: '提示',
							content: '该指标已达到扣分上限',
							success: res => {
								if (res.confirm) {
									console.log('用户点击确定');
								} else if (res.cancel) {
									console.log('用户点击取消');
								}
							}
						})
					} else {
						that.Imageforall[e.id].Imageall[b].isdscorename = true
						that.Imageforall[e.id].Imageall[b].isscorename = false
						console.log(e)
						console.log(b)
						that.ifaid = e.id
						that.iaid = b
						that.Imageforall[e.id].isdesco = true
						that.Imageforall[e.id].isscore1 = true
						that.Imageforall[e.id].Imageall[b].ban = false
						if (that.$store.state.value == 'a') {
							that.Imageforall[e.id].score1 = that.Imageforall[e.id].score1 - 0.4
							that.Imageforall[e.id].score1 = that.Imageforall[e.id].score1.toFixed(2)
							that.Imageforall[e.id].score1 = parseFloat(that.Imageforall[e.id].score1)
							that.$store.state.allcountrysidescore[e.tid] = that.Imageforall[e.id].score1
							console.log(that.Imageforall[e.id].score1)

						} else if (that.$store.state.value == 'b') {
							if (that.Imageforall[e.id].score1 == -1.7) {
								that.Imageforall[e.id].score1 = -2
								that.$store.state.allcountrysidescore[e.tid] = that.Imageforall[e.id].score1
								console.log(that.Imageforall[e.id].score1)
							} else {
								that.Imageforall[e.id].score1 = that.Imageforall[e.id].score1 - 0.34
								that.Imageforall[e.id].score1 = that.Imageforall[e.id].score1.toFixed(2)
								that.Imageforall[e.id].score1 = parseFloat(that.Imageforall[e.id].score1)
								that.$store.state.allcountrysidescore[e.tid] = that.Imageforall[e.id].score1
								console.log(that.Imageforall[e.id].score1)
							}

						} else if (that.$store.state.value == 'c') {
							if (that.Imageforall[e.id].score1 == -1.74) {
								that.Imageforall[e.id].score1 = -2
								that.$store.state.allcountrysidescore[e.tid] = that.Imageforall[e.id].score1
								console.log(that.Imageforall[e.id].score1)
							} else {
								that.Imageforall[e.id].score1 = that.Imageforall[e.id].score1 - 0.29
								that.Imageforall[e.id].score1 = that.Imageforall[e.id].score1.toFixed(2)
								that.Imageforall[e.id].score1 = parseFloat(that.Imageforall[e.id].score1)
								that.$store.state.allcountrysidescore[e.tid] = that.Imageforall[e.id].score1
								console.log(that.Imageforall[e.id].score1)
							}
						}
						// this.Imageforall[e.id].score1 = this.Imageforall[e.id].score1 - 0.12
						// that.sum2[e.id] = that.Imageforall[e.id].score1
						that.Imageforall[e.id].count += 1
						console.log('我用咖啡拉花拉出一跳白色的线，举一杯眷恋', that.$store.state.allcountrysidescore)
						console.log(that.Imageforall[e.id].count)
						console.log('-------------------')
						// console.log(that.sum2)
						console.log(that.Imageforall)
					}
				}
				if (that.$store.state.value == 'b') {
					if (that.Imageforall[e.id].count > 5) {
						uni.showModal({
							title: '提示',
							content: '该指标已达到扣分上限',
							success: res => {
								if (res.confirm) {
									console.log('用户点击确定');
								} else if (res.cancel) {
									console.log('用户点击取消');
								}
							}
						})
					} else {
						that.Imageforall[e.id].Imageall[b].isdscorename = true
						that.Imageforall[e.id].Imageall[b].isscorename = false
						console.log(e)
						console.log(b)
						that.ifaid = e.id
						that.iaid = b
						that.Imageforall[e.id].isdesco = true
						that.Imageforall[e.id].isscore1 = true
						that.Imageforall[e.id].Imageall[b].ban = false
						if (that.$store.state.value == 'a') {
							that.Imageforall[e.id].score1 = that.Imageforall[e.id].score1 - 0.4
							that.Imageforall[e.id].score1 = that.Imageforall[e.id].score1.toFixed(2)
							that.Imageforall[e.id].score1 = parseFloat(that.Imageforall[e.id].score1)
							that.$store.state.allcountrysidescore[e.tid] = that.Imageforall[e.id].score1
							console.log(that.Imageforall[e.id].score1)
						} else if (that.$store.state.value == 'b') {
							if(that.Imageforall[e.id].score1 == -1.7) {
								that.Imageforall[e.id].score1 = -2
								that.$store.state.allcountrysidescore[e.tid] = that.Imageforall[e.id].score1
								console.log(that.Imageforall[e.id].score1)
								// that.Imageforall[e.id].count += 1
							} else {
								that.Imageforall[e.id].score1 = that.Imageforall[e.id].score1 - 0.34
								that.Imageforall[e.id].score1 = that.Imageforall[e.id].score1.toFixed(2)
								that.Imageforall[e.id].score1 = parseFloat(that.Imageforall[e.id].score1)
								that.$store.state.allcountrysidescore[e.tid] = that.Imageforall[e.id].score1
								console.log(that.Imageforall[e.id].score1)
							}
						} else if (that.$store.state.value == 'c') {
							if(that.Imageforall[e.id].score1 == -1.74){
								that.Imageforall[e.id].score1 = -2
								that.$store.state.allcountrysidescore[e.tid] = that.Imageforall[e.id].score1
								console.log(that.Imageforall[e.id].score1)
							} else {
								that.Imageforall[e.id].score1 = that.Imageforall[e.id].score1 - 0.29
								that.Imageforall[e.id].score1 = that.Imageforall[e.id].score1.toFixed(2)
								that.Imageforall[e.id].score1 = parseFloat(that.Imageforall[e.id].score1)
								that.$store.state.allcountrysidescore[e.tid] = that.Imageforall[e.id].score1
								console.log(that.Imageforall[e.id].score1)
							}
						}
						// this.Imageforall[e.id].score1 = this.Imageforall[e.id].score1 - 0.12
						// that.sum2[e.id] = that.Imageforall[e.id].score1
						that.Imageforall[e.id].count += 1
						console.log('我用咖啡拉花拉出一跳白色的线，举一杯眷恋', that.$store.state.allcountrysidescore)
						console.log(that.Imageforall[e.id].count)
						console.log('-------------------')
						// console.log(that.sum2)
						console.log(that.Imageforall)
					}
				}
				if (that.$store.state.value == 'c') {
					if (that.Imageforall[e.id].count > 6) {
						uni.showModal({
							title: '提示',
							content: '该指标已达到扣分上限',
							success: res => {
								if (res.confirm) {
									console.log('用户点击确定');
								} else if (res.cancel) {
									console.log('用户点击取消');
								}
							}
						})
					} else {
						that.Imageforall[e.id].Imageall[b].isdscorename = true
						that.Imageforall[e.id].Imageall[b].isscorename = false
						console.log(e)
						console.log(b)
						that.ifaid = e.id
						that.iaid = b
						that.Imageforall[e.id].isdesco = true
						that.Imageforall[e.id].isscore1 = true
						that.Imageforall[e.id].Imageall[b].ban = false
						if (that.$store.state.value == 'a') {
							that.Imageforall[e.id].score1 = that.Imageforall[e.id].score1 - 0.4
							that.Imageforall[e.id].score1 = that.Imageforall[e.id].score1.toFixed(2)
							that.Imageforall[e.id].score1 = parseFloat(that.Imageforall[e.id].score1)
							that.$store.state.allcountrysidescore[e.tid] = that.Imageforall[e.id].score1
							console.log(that.Imageforall[e.id].score1)
						} else if (that.$store.state.value == 'b') {
							if(that.Imageforall[e.id].score1 == -1.7) {
								that.Imageforall[e.id].score1 = -2
								that.$store.state.allcountrysidescore[e.tid] = that.Imageforall[e.id].score1
								console.log(that.Imageforall[e.id].score1)
								// that.Imageforall[e.id].count += 1
							} else {
								that.Imageforall[e.id].score1 = that.Imageforall[e.id].score1 - 0.34
								that.Imageforall[e.id].score1 = that.Imageforall[e.id].score1.toFixed(2)
								that.Imageforall[e.id].score1 = parseFloat(that.Imageforall[e.id].score1)
								that.$store.state.allcountrysidescore[e.tid] = that.Imageforall[e.id].score1
								console.log(that.Imageforall[e.id].score1)
							}
						} else if (that.$store.state.value == 'c') {
							if(that.Imageforall[e.id].score1 == -1.74){
								that.Imageforall[e.id].score1 = -2
								that.$store.state.allcountrysidescore[e.tid] = that.Imageforall[e.id].score1
								console.log(that.Imageforall[e.id].score1)
							} else {
								that.Imageforall[e.id].score1 = that.Imageforall[e.id].score1 - 0.29
								that.Imageforall[e.id].score1 = that.Imageforall[e.id].score1.toFixed(2)
								that.Imageforall[e.id].score1 = parseFloat(that.Imageforall[e.id].score1)
								that.$store.state.allcountrysidescore[e.tid] = that.Imageforall[e.id].score1
								console.log(that.Imageforall[e.id].score1)
							}
						}
						// this.Imageforall[e.id].score1 = this.Imageforall[e.id].score1 - 0.12
						// that.sum2[e.id] = that.Imageforall[e.id].score1
						that.Imageforall[e.id].count += 1
						console.log('我用咖啡拉花拉出一跳白色的线，举一杯眷恋', that.$store.state.allcountrysidescore)
						console.log(that.Imageforall[e.id].count)
						console.log('-------------------')
						console.log(that.sum2)
						console.log(that.Imageforall)
					}
				}

			},
			addpicture(e, b) {
				uni.chooseImage({
					count: 1,
					sourceType: ['camera'],
					success: (res) => {
						uni.showLoading({
							title:'正在加载...',
							mask:true
						})
						console.log(res)
						console.log(e)
						console.log(e.Imageall[e.id].id)
						this.ggid = e.id
						this.ifaid = e.id
						this.dst +=
							1
						var cd =
							this
							.dst
						var ig = {
							id: cd,
							remark: '',
							isrecover: true,
							hk: null,
							remark: '',
							Image: '../../../static/th.jpg',
							fname: '拍照',
							sname: '重拍',
							ban: false,
						}
						this.Imageforall[
								this
								.ifaid
								]
							.Imageall
							.push(
								ig)
						this.iaid = b
						this.showw = true
						this.point = e.point
						if(this.Imageforall[e.id].xpremark == null){
							this.Imageforall[e.id].xpremark = this.falseremark
							this.falseremark += 1
							this.trueremark = this.Imageforall[e.id].xpremark
							console.log('falseremarkfalseremarkfalseremarkfalseremarkfalseremarkfalseremarkfalseremarkfalseremarkfalseremarkfalseremark',this.Imageforall[e.id].xpremark)
						} else {
							this.trueremark = this.Imageforall[e.id].xpremark
						}
						this.Imageforall[this.ifaid].Imageall[this.iaid].Image = res.tempFilePaths[0]
						console.log(res.tempFilePaths[0])
						uni.getLocation({
							type: 'wgs84',
							geocode: true,
							success: (res) => {
								uni.hideLoading()
								console.log(res)
								this.latitude = res.latitude
								this.longitude = res.longitude
								console.log(this.latitude)
								console.log(this.longitude)
								this.beforeAddWaterMart();
							},
							fail: function() {
								uni.showToast({
									title: '获取地址失败,请检查网络连接',
									icon: 'none'
								});
							}
						})
						// this.beforeAddWaterMart();
					}
				})
			},
			beforeAddWaterMart() {
				console.log('用了')
				this.addWaterMark(() => {
					if (this.photoIndex < this.photoArray.length - 1) {
						this.photoIndex++;
						this.beforeAddWaterMart()
					} else {
						uni.hideLoading()
					}
				})
			},
			addWaterMark(callback) {
				uni.showLoading({
					title: '正在加载水印...',
					mask: true
				})
				console.log('用了')
					uni.getImageInfo({
						src: this.Imageforall[this.ifaid].Imageall[this.iaid].Image,
						success: res => {
							console.log(res)
							this.time = this.getTime();
							if (this.canvasHeight != res.height || this.canvasWidth != res.width) {
								this.canvasWidth = res.width + 'px'
								this.canvasHeight = res.height + 'px'
							} else {
								this.canvasWidth = res.width + 'px'
								this.canvasHeight = res.height + 'px'
							}
							var ctx = uni.createCanvasContext('myCanvas');
							setTimeout(()=>{
								ctx.drawImage(this.Imageforall[this.ifaid].Imageall[this.iaid].Image, 0, 0,
									res.width, res.height);
								// ctx.translate(res.width / 2, res.height / 2);
								
								ctx.beginPath();
								ctx.setFontSize(40);
								ctx.setFillStyle("white")
								ctx.fillText('地点:' + this.$store.state.address, 0, 100)
								ctx.fillText(this.time, 0, 200);
								ctx.fillText('纬度:' + this.latitude + '  ' + '经度:' + this.longitude, 0, 300)
								ctx.draw(false, () => {
									console.log('用了')
										console.log("asdf")
										uni.canvasToTempFilePath({
											canvasId: "myCanvas",
											success: res => {
												console.log(res.tempFilePath)
												// this.Imageforall[this.ifaid].Imageall[this
												// 	.iaid].Image = res.tempFilePath;
												this.showw = false
												this.tempFilePath = res
													.tempFilePath
												// var formData = new FormData();
												//     formData.append('file', this.tempFilePath);
												console.log(this.Imageforall)
												uni.compressImage({
													src:res.tempFilePath,
													quality:0,
													success: (res) => {
														uni.compressImage({
															src:res.tempFilePath,
															quality:0,
															success: (res) => {
																
																		uni.saveImageToPhotosAlbum({
																	filePath: res
																		.tempFilePath,
																	success: (res) => {
																		this.Imageforall[
																				this
																				.ifaid
																				]
																			.Imageall[
																				this
																				.iaid
																				]
																			.Image =
																			res
																			.path;
																		console
																			.log(
																				res
																				)
																		// uni.uploadFile({
																		// 	url: 'http://192.168.0.37:8000/kaoping/evidence/image/',
																		// 	filePath: this.Imageforall[this.ifaid].Imageall[this.iaid].Image,
																		// 	name: 'image',
																		// 	success: res => {
																		// 		uni.showToast({
																		// 			title: "保存成功",
																		// 			icon: "none"
																		// 		});
																		// 		setTimeout
																		// 			(() => {
																		// 					uni.hideLoading()
																		// 				},
																		// 				2000
																		// 				)
																		// 		console.log('错误')
																		// 		console.log(res)
																		// 		console.log(this.Imageforall[this.ifaid].Imageall[this.iaid].Image)
																		// 	}
																		// })
																		if (this
																			.Imageforall[
																				this
																				.ifaid
																				]
																			.first
																			) {
																			this.Imageforall[this.ifaid].Imageall[this.iaid].hk = this.soyn
																			this.Imageforall[this.ifaid].index = this.index
																			this.index += 1
																			this.soyn +=
																				1
																			this.Imageforall[
																					this
																					.ifaid
																					]
																				.first =
																				false
																			var sa = {
																				point:this.point,
																				name:this.Imageforall[this.ifaid].name,
																				Imageall: [{
																					remark: '无',
																					Image: this
																						.Imageforall[
																							this
																							.ifaid
																							]
																						.Imageall[
																							this
																							.iaid
																							]
																						.Image,
																				}]
																			}
																			this.alist
																				.push(
																					sa
																					)
																			var set =
																				new Set(
																					this
																					.alist
																					)
																			var thisset = [
																				...
																				set
																			]
																			this.alllist =
																				thisset
																			console
																				.log(
																					'巴士克特波',
																					this
																					.alllist
																					)
																			if (this
																				.firstfirst
																				) {
																				this.Imageforall[
																						this
																						.ifaid
																						]
																					.firstfirst =
																					false
																				// this.$store.state.decifm.push(...this.alist)
																			} else {
																				// this.$store.state.decifm.push(...sa)
																			}
																			console
																				.log(
																					this
																					.$store
																					.state
																					.decifm
																					)
																		} else {
																			if (this
																				.Imageforall[
																					this
																					.ifaid
																					]
																				.Imageall[
																					this
																					.iaid
																					]
																				.hk ==
																				null
																				) {
																				this.Imageforall[
																						this
																						.ifaid
																						]
																					.Imageall[
																						this
																						.iaid
																						]
																					.hk =
																					this
																					.soyn
																				this.soyn +=
																					1
																				var ta = {
																					remark: '无',
																					Image: this
																						.Imageforall[
																							this
																							.ifaid
																							]
																						.Imageall[
																							this
																							.iaid
																							]
																						.Image
																				}
																				this.alist[this.Imageforall[this.ifaid].index].Imageall.push(ta)
																				console
																					.log(
																						ta
																						)
																				// this.$store.state.decifm[this.ifaid].Imageall.push(ta)
																				console
																					.log(
																						this
																						.$store
																						.state
																						.decifm
																						)
																				var set =
																					new Set(
																						this
																						.alist
																						)
																				var thisset = [
																					...
																					set
																				]
																				this.alist =
																					thisset
																				console
																					.log(
																						'巴士克特波',
																						this
																						.alist
																						)
																			} else {
																				var recover =
																					this
																					.Imageforall[
																						this
																						.ifaid
																						]
																					.Imageall[
																						this
																						.iaid
																						]
																					.Image
																				this.alist[this.Imageforall[this.ifaid].index].Imageall[this.Imageforall[this.ifaid].Imageall[this.iaid].hk
																						].Image = recover
																				console
																					.log(
																						recover
																						)
																				// this.$store.state.decifm[this.ifaid].Imageall.push(ta)
																				console
																					.log(
																						this
																						.$store
																						.state
																						.decifm
																						)
																				var set =
																					new Set(
																						this
																						.alist
																						)
																				var thisset = [
																					...
																					set
																				]
																				this.alist =
																					thisset
																				console
																					.log(
																						'巴士克特波',
																						this
																						.alist
																						)
																				console
																					.log(
																						this
																						.Imageforall[
																							this
																							.ifaid
																							]
																						.Imageall[
																							this
																							.iaid
																							]
																						.hk
																						)
																			}
																		}
																		console
																			.log(
																				this
																				.Imageforall[
																					this
																					.ifaid
																					]
																				.first
																				)
																		console
																			.log(
																				'它来了它来了',
																				this
																				.alist
																				)
																		
																		console
																			.log(
																				this
																				.Imageforall
																				)
																								
																		// console.log(this.$store.state.decifm)
																		
																		uni.setStorage({
																			key: 'imgc1',
																			data: this
																				.Imageforall,
																			success: (
																				res
																				) => {
																				console
																					.log(
																						'成功了'
																						)
																				console
																					.log(
																						res
																						)
																				console
																					.log(
																						this
																						.Imageforall
																						)
																			}
																		})
																		uni.setStorage({
																			key: 'detc1',
																			data: {
																				det: this
																					.det,
																				alist: this
																					.alist,
																				soyn:this.soyn,
																				dst:this.dst,
																				index:this.index
																			},
																			success: (
																				res
																				) => {
																				console
																					.log(
																						'成功了'
																						)
																				console
																					.log(
																						res
																						)
																				console
																					.log(
																						this
																						.dst
																						)
																			}
																		})
																		uni.setStorage({
																			key:'countryside',
																			data:this.$store.state.allcountrysidescore,
																			success: (res) => {
																				console.log(res)
																				console.log(this.$store.state.allcountrysidescore)
																			}
																		})
																		uni.showToast({
																			title: "保存成功",
																			icon: "none"
																		});
																	},
																	fail: err => {
																		console
																			.log(
																				err
																				)
																		uni.showToast({
																			title: "保存失败，请稍后重试",
																			icon: "none"
																		});
																	}
																});
																	
															}
														})
													}
												})
												
												uni.showToast({
													title: '加载成功',
													icon: 'success',
													duration: 2000,
													mask:true
												})
												callback();
												console.log('用完了')
											}
										})
								});
							},100)
						},
						fail: function() {
							uni.showToast({
								title: '获取图片失败',
								icon: 'none'
							});
						}
					})

			},
			checkimg(e, b) {
				console.log(e)
				console.log(b)
				uni.previewImage({
					urls: [this.Imageforall[e.id].Imageall[b].Image],
					success: (res) => {
						console.log(this.Imageforall[e.id].Imageall[b].Image)
					},
					fail: function() {
						uni.showToast({
							title: '网络错误,请检查网络连接',
							icon: 'none'
						});
					}
				})
			},
			submit() {
				this.$store.state.decifm.push(...this.alist)
				const combinedData = this.$store.state.decifm.reduce((acc, cur) => {
					const found = acc.find(obj => obj.name === cur.name);
					if (found) {
						found.Imageall.push(...cur.Imageall);
					} else {
						acc.push(cur);
					}
					return acc;
				}, []);
				console.log(combinedData);
				const uniqueArr = combinedData.filter((item, index) => {
					return combinedData.findIndex(obj => {
						return JSON.stringify(obj) === JSON.stringify(item);
					}) === index;
				});
				this.$store.state.decifm = uniqueArr
				console.log(uniqueArr);
				var thedec = new Set(this.$store.state.decifm)
				console.log(thedec)
				var truedec = [...thedec]
				this.$store.state.decifm = truedec
				console.log(truedec)
				this.$store.state.decifm.forEach((item) => {
					const lb = new Set(item.Imageall.map((image) => image.Image));
					item.Imageall = Array.from(lb).map((image) => {
						return item.Imageall.find((img) => img.Image === image);
					});
				});
				uni.showToast({
					title: '保存成功'
				})
				uni.setStorage({
					key: 'alldecifm',
					data: this.$store.state.decifm,
					success: (res) => {
						console.log(res)
					}
				})
				// uni.request({
				// 	url: 'http://192.168.0.37:8000/kaoping/excelfile/',
				// 	method: 'POST',
				// 	data: {
				// 		name: 'sad',
				// 		score_list: this.sum2,
				// 		category: '123',
				// 		position: '2222'
				// 	},
				// 	success: res => {
				// 		console.log('传好了')
				// 		console.log(res)
				// 	}
				// })
			}

		}
	}
</script>

<style scoped>
	.picbtn {
		/* float: left; */
		font-size: 20rpx;
		width: 100rpx;
		height: 50rpx;
		background-color: pink;
		margin-left: 20rpx;
		margin-top: 10rpx;
	}

	.bottom-btn {
		position: fixed;
		margin-top: 20rpx;
		width: 100%;
		bottom: 0rpx;
	}

	.bmbtn {
		background-color: skyblue;
		color: whitesmoke;
	}

	.bmbtn:active {
		background-color: deepskyblue;
	}

	.uppoborder {
		width: 750rpx;
		border: 1px solid skyblue;
		background-color: #F8F8FF;
		text-align: center;
		margin-top: 10rpx;
	}
	.uppoborder:active {
		background-color: deepskyblue;
	}
	.tjid {
		width: 750rpx;
		height: 860rpx;
		background-color: #363636;


		/* transform: rotate(45deg); */
		/* opacity: 0; */
	}

	.delete {
		position: fixed;
		bottom: 0;
		/* right: 200rpx; */
		width: 70rpx;
		height: 70rpx;
		border-radius: 50%;
		margin-left: 365rpx;
		margin-top: 960rpx;
		transform: rotate(45deg);
		color: white;
		font-size: 80rpx;
		text-align: center;
		/* background-color: pink; */

	}

	.remark {
		font-size: 20rpx;
		width: 100rpx;
		height: 50rpx;
		background-color: pink;
		margin-left: 20rpx;
		margin-top: 10rpx;
	}

	.uppoo {
		/* float: left; */
		background-color: white;
		width: 750rpx;
		height: 750rpx;
		/* opacity: 0.1; */
		z-index: 1;
	}

	.scorebtn {
		font-size: 20rpx;
		/* margin-top: -50rpx; */
		width: 100rpx;
		height: 50rpx;
		margin-top: 15rpx;
		margin-left: 20rpx;
		/* margin-left: 450rpx; */
		/* background-color: pink; */
	}

	.btn {
		float: left;
		/* margin-top: 150rpx; */
	}

	.border {
		clear: both;
		width: 750rpx;
		border: 1px solid skyblue;
		background-color: #F8F8FF;
	}

	.desco {
		float: right;
		width: 115rpx;
		height: 115rpx;
		line-height: 110rpx;
		text-align: center;
		/* margin-left: 600rpx; */
		margin-right: 25rpx;
		margin-top: 15rpx;
		border-radius: 50%;
		border: 1px solid red;
		/* background-color: red; */
		color: red;
	}

	.scoref {
		float: right;
		/* margin-left: 300rpx; */
		margin-right: 20rpx;
		margin-top: -50rpx;
		color: red;
	}

	.scroll {
		height: 100%;
	}
</style>